package org.jeewx.api.third.model;

import net.sf.json.JSONObject;

/**
 * 
 * @author chenb { "openid":" OPENID", "nickname": NICKNAME, "sex":"1",
 *         "province":"PROVINCE", "city":"CITY", "country":"COUNTRY",
 *         "headimgurl":
 *         "http://thirdwx.qlogo.cn/mmopen/g3MonUZtNHkdmzicIlibx6iaFqAc56vxLSUfpb6n5WKSYVY0ChQKkiaJSgQ1dZuTOgvLLrhJbERQQ4eMsv84eavHiaiceqxibJxCfHe/46",
 *         "privilege":[ "PRIVILEGE1" "PRIVILEGE2" ], "unionid":
 *         "o6_bmasdasdsad6_2sgVt7hMZOPfL" }
 *
 */
public class SnsapiUserinfo {
	private String openid;
	private String nickname;
	private String sex;
	private String province;
	private String city;
	private String country;
	private String language;
	private String headimgurl;
	private Object privilege;
	private String unionid;

	public String getOpenid() {
		return openid;
	}

	public void setOpenid(String openid) {
		this.openid = openid;
	}

	public String getNickname() {
		return nickname;
	}

	public void setNickname(String nickname) {
		this.nickname = nickname;
	}

	public String getSex() {
		return sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	public String getProvince() {
		return province;
	}

	public void setProvince(String province) {
		this.province = province;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public String getCountry() {
		return country;
	}

	public void setCountry(String countyy) {
		this.country = countyy;
	}

	public String getLanguage() {
		return language;
	}

	public void setLanguage(String language) {
		this.language = language;
	}

	public String getHeadimgurl() {
		return headimgurl;
	}

	public void setHeadimgurl(String headimgurl) {
		this.headimgurl = headimgurl;
	}

	public String getUnionid() {
		return unionid;
	}

	public void setUnionid(String unionid) {
		this.unionid = unionid;
	}

	public Object getPrivilege() {
		return privilege;
	}

	public void setPrivilege(Object privilege) {
		this.privilege = privilege;
	}

	public JSONObject toJSON() {
		JSONObject resp = new JSONObject();
		//resp.accumulate("openid", (this.openid != null) ? this.openid : "");
		resp.accumulate("nickname", (this.nickname != null) ? this.nickname : "");
		resp.accumulate("sex", (this.sex != null) ? this.sex : "");
		resp.accumulate("province", (this.province != null) ? this.province : "");
		resp.accumulate("city", (this.city != null) ? this.city : "");
		resp.accumulate("county", (this.country != null) ? this.country : "");
		resp.accumulate("language", (this.language != null) ? this.language : "");
		resp.accumulate("headimgurl", (this.headimgurl != null) ? this.headimgurl : "");
		// resp.accumulate("privilege", (this.privilege != null) ? this.privilege : "");
		resp.accumulate("unionid", (this.unionid != null) ? this.unionid : "");

		return resp;
	}
}
